package presenters;

import java.util.Observable;
import java.util.Observer;
import presenters.chain.Handler;
import presenters.chain.PerformTaskHandler;
import presenters.chain.UndoTaskHandler;
import model.IModel;

public class Presenter implements Observer {
	private IModel _iModel = null;
	
	public Presenter(IModel iModel) {
		_iModel=iModel;
	}
	
	@Override
	public void update(Observable arg0, Object arg1) {
		//Chain of responsibility
		Handler performHandler = new PerformTaskHandler();
		Handler undoHandler = new UndoTaskHandler();
		performHandler.setSuccessor(undoHandler);
		performHandler.handle(_iModel, arg1);
	}

}
